#ifndef OSDREMOTESERVICEMODEL_H
#define OSDREMOTESERVICEMODEL_H

#include <QObject>
#include <QThread>
#include "../remoteservice/baseresp.h"
#include "../remoteservice/scheduleinfo.h"
#include "../remoteservice/platfromstatusinfo.h"
#include "../remoteservice/devicestatusinfo.h"
#include "../remoteservice/svcstatusinfo.h"
#include "../remoteservice/systemstatusinfo.h"
#include "../remoteservice/micinfo.h"
#include "../remoteservice/camerainfo.h"
#include "../remoteservice/callinfo.h"
#include "../remoteservice/productinfo.h"
#include "../remoteservice/networkinfo.h"
#include "../remoteservice/systemtimeinfo.h"
#include "../remoteservice/configinfo.h"
#include "../remoteservice/statinfo.h"
#include "../remoteservice/newversioninfo.h"

class UDPThreadWorker;

class OSDRemoteServiceModel : public QObject
{
    Q_OBJECT
    explicit OSDRemoteServiceModel(QObject *parent = 0);
public:
    static OSDRemoteServiceModel &instance();

    void quit();
    //远程服务器查询接口
    void deviceRegisterStatus();
    void deviceUsingStatus();
    void svcRegisterStatus();
    void systemStatus();
    void micStatus();
    void cameraStatus();
    void callStatus();
    void productInfo();
    void networkStatus();
    void systimeInfo();
    void config(QString key);
    void schedules();
    void version();
    void stats();

    //操作接口

    void registerDevice();
    void call(QString number, QString pwd, QString name="");
    void leaveConference();
    void sendContent(bool enable);
    void sendMic(bool enable);
    void sendCamera(bool enable);
    void modifyNetwork(QString ip, QString mask, QString gateway, QString dns);
    void reboot();
    void standby();
    void modifyConfig(QString key, QVariant v);
    void upgrade();
    void recover();

private slots:
    void dealLeaveConf();
    void dealEnterInConf();
    void dealScheduleList(QString);
    void processPendingDatagram(QString msg);
    void response(QString,QString);
    void updateCellName(QString);

signals:
    void notifyLeaveConf();
    void notifyEnterInConf();
    void notifyScheduleList(ScheduleInfo);
    void notifyDeviceRegisterStatus(PlatfromStatusInfo);
    void notifyDeviceUsingStatus(DeviceStatusInfo);
    void notifySvcRegisterStatus(SVCStatusInfo);
    void notifySystemStatus(SystemStatusInfo);
    void notifyMicStatus(MicInfo);
    void notifyCameraStatus(CameraInfo);
    void notifyCallStatus(CallInfo);
    void notifyProductInfo(ProductInfo);
    void notifyNetworkStatus(NetworkInfo);
    void notifySystimeInfo(SystemTimeInfo);
    void notifyConfigInfo(ConfigInfo);
    void notifyVersion(NewVersionInfo);
    void notifyStats(StatInfo);
    void notifyRegister(BaseResp);
    void notifyCall(BaseResp);
    void notifyLeaveConference(BaseResp);
    void notifySendContent(BaseResp);
    void notifySendMic(BaseResp);
    void notifySendCamera(BaseResp);
    void notifyModifyNetwork(BaseResp);
    void notifyReboot(BaseResp);
    void notifyStandby(BaseResp);
    void notifyModifyConfig(BaseResp);
    void notifyUpgrade(BaseResp);
    void pushMsg(QString method, QString msg);
    void notifyExitApp();
    void notifyUpdateCellName(QString);

private:
    QString generateCommand(QString module, QString event, QString data);
    
private:
    QThread m_thread;
    UDPThreadWorker *m_worker;
    
};

#endif // OSDREMOTESERVICEMODEL_H
